package com.example.demo.judge.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Data
@Component
@ConfigurationProperties(prefix = "judge0")
public class JudgeConfigHelper {
    /**
     * Judge0 鉴权帮助类
     */
    public static String SERVER_PATH;

    public static String AUTH_TOKEN_KEY;

    public static String AUTH_TOKEN_VALUE;

    public static String AUTH_USER_KEY;

    public static String AUTH_USER_VALUE;

    @Value("serverPath")
    private String server_path;
    @Value("authTokenKey")
    private String auth_token_key;
    @Value("authTokenValue")
    private String auth_token_value;
    @Value("authUserKey")
    private String auth_user_key;
    @Value("authUserValue")
    private String auth_user_value;

    @PostConstruct
    public void init() {
        SERVER_PATH = this.server_path;
        AUTH_TOKEN_KEY = this.auth_token_key;
        AUTH_TOKEN_VALUE = this.auth_token_value;
        AUTH_USER_KEY = this.auth_user_key;
        AUTH_USER_VALUE = this.auth_user_value;
    }

}
